package com.lxz.shardingjdbcdemo.config;

import org.apache.shardingsphere.broadcast.api.config.BroadcastRuleConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

/**
 * 广播表配置类
 * 用于配置需要在所有数据源中同步的表
 */
@Configuration
public class BroadcastTableConfig {

    /**
     * 创建广播表规则配置
     * 
     * @return 广播表规则配置
     */
    @Bean
    public BroadcastRuleConfiguration broadcastRuleConfiguration() {
        Set<String> broadcastTables = new HashSet<>();
        broadcastTables.add("t_user_type");
        return new BroadcastRuleConfiguration(broadcastTables);
    }
}